//余额显示
//用户积分
$("#wode>article>.touxiang>h4>span").text(RssUser.Data.integral);
//用户头像
$("#wode>article>div>img").attr("src",RssUser.Data.avatar);
//用户昵称
$("#wode>article>div>h1").text(RssUser.Data.nickname);
//用户余额
$("#wode>article>.touxiang>h3").text(RssUser.Data.availablefunds);
//钱包
$("#qianbao>article>div>p>span").text(RssUser.Data.availablefunds);
function shuaxing() {
	//填写用户积分
	var jifeng = $("#wode>article>.touxiang>h4>span");
	//填写用户头像	
	var touxiang = $("#wode>article>div>img");
	//填写用胡昵称
	var nickname = $("#wode>article>div>h1");
	//填写用户余额
	var yue = $("#wode>article>.touxiang>h3");
	//填写钱包余额
	var qianbao = $("#qianbao>article>div>p>span");
	//获取余额
	new Ajax("/account/yue").keyvalue("myid", RssUser.Data.myid).getJson(function(data) {
		if(data[0].availablefunds == undefined) {
			yue.text(0);
			qianbao.text(0);
		} else {
			yue.text(data[0].availablefunds);
			qianbao.text(data[0].availablefunds);
		}
		touxiang.attr("src", RssUser.Data.avatar);
		nickname.text(data[0].nickname);
		jifeng.text(data[0].integral);
	})
}
//精彩推荐
function jingcai(v,stat){
	var jingcai_list = $("#kechengpeixun>article>.d4>.d5>ul");
	if(stat=="2"){
			jingcai_list.append("<li dataid=" + v["id"] + ">" + "<a href=/fenxiang/kechengxiangqing.html?dataid=" + v["id"] + ">" + "<img src=" + http + v["ico"] + ">" + "<h1>" + v["title"] + "</h1>" + "<div>" + "<p>" + v["jianjie"] + "</p>" + "</div>" + "<h2>￥" + "<span>" + v["jiage"] + "</span>" + "元</h2>" + "<h3>参与人数" + v["canyurenshu"] + "人</h3>" + "<h4>限时免费</h4></a>" + "</li>");
		}else{
			jingcai_list.append("<li dataid=" + v["id"] + ">" + "<a href=/fenxiang/kechengxiangqing.html?dataid=" + v["id"] + ">" + "<img src=" + http + v["ico"] + ">" + "<h1>" + v["title"] + "</h1>" + "<div>" + "<p>" + v["jianjie"] + "</p>" + "</div>" + "<h4>￥" + v["jiage"] + "元</h4>" + "<h3>参与人数" + v["canyurenshu"] + "人</h3></a>" + "</li>");
		}
}
//首页功能课程课程展示
function gongneng (v,a){
 var renshu = un(v["canyurenshu"]);
	 $("#shouye>article>.gy>.gongneng>ul").append("<li dataid=" + v["id"] + ">" + "<a href=/fenxiang/kechengxiangqing.html?dataid=" + v["id"] + ">" + "<img src=" + http + v["ico"] + ">" + "<h1>" + v["title"] + "</h1>" + "<div>" + "<p>" + v["jianjie"] + "</p>" + "</div>" + "<h2>￥" + "<span>" + v["jiage"] + "</span>" + "元</h2>" + "<h3>参与人数" + renshu + "人</h3>" + "</a>" + "</li>");

        if (v["status"] == 2) {
            $("#shouye>article>.gy>.gongneng>ul>li").eq(a).find('a').append("<h4>" + "限时免费" + "</h4>");
        } else {
            $("#shouye>article>.gy>.gongneng>ul>li").eq(a).find('h2').hide();
            $("#shouye>article>.gy>.gongneng>ul>li").eq(a).find('a').append("<h4>￥" + v["jiage"] + "元</h4>");
        }
}
//系列课程
function xilie (v,a){
	var renshu = un(v["canyurenshu"]);
	$("#shouye>article>.gy>.xile>ul").append("<li dataid=" + v["id"] + ">" + "<a href=/fenxiang/kechengxiangqing.html?dataid=" + v["id"] + ">" + "<img src=" + http + v["ico"] + ">" + "<h1>" + v["title"] + "</h1>" + "<div>" + "<p>" + v["jianjie"] + "</p>" + "</div>" + "<h2>￥" + "<span>" + v["jiage"] + "</span>" + "元</h2>" + "<h3>参与人数" + renshu + "人</h3>" + "</a>" + "</li>");

        if (v["status"] == 2) {
            $("#shouye>article>.gy>.xile>ul>li").eq(a).find('a').append("<h4>" + "限时免费" + "</h4>");
        } else {
            $("#shouye>article>.gy>.xile>ul>li").eq(a).find('h2').hide();
            $("#shouye>article>.gy>.xile>ul>li").eq(a).find('a').append("<h4>￥" + v["jiage"] + "元</h4>");
        }
}
//近期下线培训
function jingqi(v,quanbu){
	    var st = v["starttime"] * 1000;
	    var edt = v["endtime"] * 1000;
	    var start = new Date(st).toLocaleString().substr(0, 10);
        var end = new Date(edt).toLocaleString().substr(0, 10); 
        if(quanbu){
        	$("#peixunliebiao>article>ul").append("<li dataid=" + v["id"] + ">" + "<a href=/fenxiang/peixun.html?dataid=" + v["id"] + ">" + "<img src=" + http + v["ico"] + ">" + "<h1>" + v["title"] + "</h1>" + "<div></div><h3>"+start+"-"+end+"</h3>" + "</a>" + " <p>剩余名额：<span>20</span>人</p></li>");
        }else{
        	$("#shouye>article>.gy>.liebiao>ul").append("<li dataid=" + v["id"] + ">" + "<a href=/fenxiang/peixun.html?dataid=" + v["id"] + ">" + "<img src=" + http + v["ico"] + ">" + "<h1>" + v["title"] + "</h1>" + "<div></div><h3>"+start+"-"+end+"</h3>" + "</a>" + "<p>剩余名额：<span>"+v["renshu_yu"]+"</span>人</p></li></li>");
        }
        
}

//标签切换
function qiehuan(v,a,fenlei){
	if(v["canyurenshu"] == "" || v["canyurenshu"] == undefined) {
					v["canyurenshu"] = 0;
				}
				if(v["fenleiid"] == fenlei) {
$("#shouye>article>.yunqi>.d5>ul").append("<li dataid=" + v["id"] + ">" + "<a href=/fenxiang/kechengxiangqing.html?dataid=" + v["id"] + ">" + "<img src=" + http + v["ico"] + ">" + "<h1>" + v["title"] + "</h1>" + "<div>" + "<p>" + v["jianjie"] + "</p>" + "</div>" + "<h2>￥" + "<span>" + v["jiage"] + "</span>" + "元</h2>" + "<h3>参与人数" + v["canyurenshu"] + "人</h3>" + "</a>" + "</li>")
				
				if(v["status"] == 2) {
					$("#shouye>article>.yunqi>.d5>ul>li").eq(a).find('a').append("<h4>" + "限时免费" + "</h4>");
				} else {
					$("#shouye>article>.yunqi>.d5>ul>li").eq(a).find('h2').hide();
					$("#shouye>article>.yunqi>.d5>ul>li").eq(a).find('a').append("<h4>￥" + v["jiage"] + "元</h4>");
				}
				return ++a;
				};
				return a;
}


//处理未定义数据
function un(k){
	if(k==undefined){
		return 0;
	}else{
		return k;
	}
}




